-- CALC_CHARGE_GEM

-- 计算充值可获得的钻石
-- @param goodsId 商品id
return function(goodsId, isPt)
    if MarketM.query(goodsId, "classify") ~= "recharge" then
        -- 不是充值类商品
        return 0;
    end

    -- 基础奖励
    local gemBonus = MarketM.query(goodsId, "bonus")[1];
    local baseAmount = gemBonus[3];

    -- 补偿奖励
    local compensateGem = MarketM.calcCompensateGem(goodsId, isPt);
    local gem = baseAmount + compensateGem;

    -- 首充双倍
    local buyTimes = MarketM.getBuyTimes(goodsId);
    if buyTimes <= 0 then
        gem = gem * 2;
    end

    return gem;
end
